<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en" class="app">
<head>
    <meta charset="utf-8"/>
    <title>后台管理 | 后盾人</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/css/bootstrap.css" type="text/css"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/css/animate.css" type="text/css"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/css/font-awesome.min.css" type="text/css"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/css/font.css" type="text/css"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/js/calendar/bootstrap_calendar.css" type="text/css"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/js/jvectormap/jquery-jvectormap-1.2.2.css" type="text/css"/>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/css/app.css" type="text/css"/>
    <!--[if lt IE 9]>
    <script src="/c73/php_beijing/mall/Public/js/ie/html5shiv.js"></script>
    <script src="/c73/php_beijing/mall/Public/js/ie/respond.min.js"></script>
    <script src="/c73/php_beijing/mall/Public/js/ie/excanvas.js"></script>
    <![endif]-->
    <script>
        //配置后台地址
        var hdjs = {
            'base': '/c73/php_beijing/mall/node_modules/hdjs',
            'ueditor': '',
            'uploader': '/admin/Component/uploader',
            'filesLists': '/admin/Component/filesLists',
            'removeImage': '删除图片后台地址'
        };
    </script>
    <!--<script src="/node_modules/hdjs/app/util.js"></script>-->
    <script src="/c73/php_beijing/mall/node_modules/hdjs/require.js"></script>
    <script src="/c73/php_beijing/mall/node_modules/hdjs/config.js"></script>
    <link rel="stylesheet" href="/c73/php_beijing/mall/Public/css/page.css">
</head>
<style>
    .ng-cloak {
        display: none;
    }
</style>
<body ng-cloak class="ng-cloak" ng-controller="ctrl">
<section class="vbox">
    <header class="bg-black dk header navbar navbar-fixed-top-xs">
        <div class="navbar-header aside-md">
            <a class="btn btn-link visible-xs" data-toggle="class:nav-off-screen,open" data-target="#nav,html">
                <i class="fa fa-bars"></i>
            </a>
            <a href="#" class="navbar-brand" data-toggle="fullscreen"><img src="/c73/php_beijing/mall/Public/images/logo.png"
                                                                           class="m-r-sm"><?php echo v('config.system.webname');?></a>
            <a class="btn btn-link visible-xs" data-toggle="dropdown" data-target=".nav-user">
                <i class="fa fa-cog"></i>
            </a>
        </div>
        <ul class="nav navbar-nav hidden-xs">
            <li class="dropdown">
                <a href="<?php echo u('admin/goods/lists');?>" >
                    <i class="fa fa-wordpress"></i>
                    <span class="font-bold">商品列表</span>
                </a>
            </li>
            <li class="dropdown">
                <a href="<?php echo u('admin/type/lists');?>" class="dropdown-toggle dker">
                    <i class="fa fa-paper-plane"></i>
                    <span class="font-bold">类型列表</span>
                </a>
            </li>
            <li class="dropdown">
                <a href="<?php echo U('admin/config/set');?>" class="dropdown-toggle dker">
                    <i class="fa fa-building-o"></i>
                    <span class="font-bold">配置管理</span>
                </a>
            </li>
        </ul>
        <ul class="nav navbar-nav navbar-right m-n hidden-xs nav-user">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            <span class="thumb-sm avatar pull-left">
              <img src="/c73/php_beijing/mall/Public/images/avatar.jpg">
            </span>
                    <?php echo session('admin.username');?> <b class="caret"></b>
                </a>
                <ul class="dropdown-menu animated fadeInRight">
                    <span class="arrow top"></span>
                    <li>
                        <a href="<?php echo u('admin/user/loginOut');?>">退出</a>
                    </li>
                </ul>
            </li>
        </ul>
    </header>
    <section>
        <section class="hbox stretch">
            <!-- .aside -->
            <aside class="bg-light lter b-r aside-md hidden-print hidden-xs" id="nav">
                <section class="vbox">
                    <header class="header bg-primary lter text-center clearfix">
                        <div class="btn-group">
                            <button type="button" class="btn btn-sm btn-dark btn-icon" title="New project"><i
                                    class="fa fa-plus"></i></button>
                            <div class="btn-group hidden-nav-xs">
                                <button type="button" class="btn btn-sm btn-primary dropdown-toggle"
                                        data-toggle="dropdown">
                                    快捷导航
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu text-left">
                                    <li><a href="<?php echo U('admin/config/set');?>">网站配置</a></li>
                                </ul>
                            </div>
                        </div>
                    </header>
                    <section class="w-f scrollable">
                        <div class="slim-scroll" data-height="auto" data-disable-fade-out="true" data-distance="0"
                             data-size="5px" data-color="#333333">

                            <!-- nav -->
                            <nav class="nav-primary hidden-xs">
                                <ul class="nav">
                                    <li class="active">
                                        <a href="index.html" class="active">
                                            <i class="fa fa-dashboard icon">
                                                <b class="bg-danger"></b>
                                            </i>
                                            <span class="pull-right">
                          <i class="fa fa-angle-down text"></i>
                          <i class="fa fa-angle-up text-active"></i>
                        </span>
                                            <span>基本设置</span>
                                        </a>
                                        <ul class="nav lt">
                                            <li>
                                                <a href="<?php echo U('admin/config/set');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>网站配置</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <a href="#uikit">
                                            <i class="fa fa-flask icon">
                                                <b class="bg-success"></b>
                                            </i>
                                            <span class="pull-right">
                          <i class="fa fa-angle-down text"></i>
                          <i class="fa fa-angle-up text-active"></i>
                        </span>
                                            <span>商品管理</span>
                                        </a>
                                        <ul class="nav lt">
                                            <li>
                                                <a href="<?php echo u('admin/goods/addGoods');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>添加商品</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="<?php echo u('admin/goods/lists');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>商品列表</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </li>

                                    <li>
                                        <a href="#uikit">
                                            <i class="fa fa-flask icon">
                                                <b class="bg-success"></b>
                                            </i>
                                            <span class="pull-right">
                          <i class="fa fa-angle-down text"></i>
                          <i class="fa fa-angle-up text-active"></i>
                        </span>
                                            <span>品牌管理</span>
                                        </a>
                                        <ul class="nav lt">
                                            <li>
                                                <a href="<?php echo u('admin/brand/handler');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>添加品牌</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="<?php echo u('admin/brand/lists');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>品牌列表</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <a href="#uikit">
                                            <i class="fa fa-flask icon">
                                                <b class="bg-success"></b>
                                            </i>
                                            <span class="pull-right">
                          <i class="fa fa-angle-down text"></i>
                          <i class="fa fa-angle-up text-active"></i>
                        </span>
                                            <span>分类管理</span>
                                        </a>
                                        <ul class="nav lt">
                                            <li>
                                                <a href="<?php echo u('admin/category/handler');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>添加分类</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="<?php echo u('admin/category/lists');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>分类列表</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </li>
                                    <li>
                                        <a href="#uikit">
                                            <i class="fa fa-flask icon">
                                                <b class="bg-success"></b>
                                            </i>
                                            <span class="pull-right">
                          <i class="fa fa-angle-down text"></i>
                          <i class="fa fa-angle-up text-active"></i>
                        </span>
                                            <span>类型管理 </span>
                                        </a>
                                        <ul class="nav lt">
                                            <li>
                                                <a href="<?php echo u('admin/type/handler');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>添加类型</span>
                                                </a>
                                            </li>
                                            <li>
                                                <a href="<?php echo u('admin/type/lists');?>">
                                                    <i class="fa fa-angle-right"></i>
                                                    <span>类型列表</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </li>
                                    <?php if(is_array($_module)): $i = 0; $__LIST__ = $_module;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li>
                                            <a href="#uikit">
                                                <i class="fa fa-flask icon">
                                                    <b class="bg-success"></b>
                                                </i>
                                                <span class="pull-right">
                          <i class="fa fa-angle-down text"></i>
                          <i class="fa fa-angle-up text-active"></i>
                        </span>
                                                <span><?php echo ($vo['title']); ?></span>
                                            </a>
                                            <ul class="nav lt">
                                                <?php if(is_array($vo["actions"])): $i = 0; $__LIST__ = $vo["actions"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vv): $mod = ($i % 2 );++$i;?><li>
                                                        <a href="<?php echo site_url($vo['name'].'.'.$vv['name']);?>">
                                                            <i class="fa fa-angle-right"></i>
                                                            <span><?php echo ($vv['title']); ?></span>
                                                        </a>
                                                    </li><?php endforeach; endif; else: echo "" ;endif; ?>
                                                <?php if($vo['message']==1): ?><li>
                                                        <a href="<?php echo u('Module/keywords/lists',['mo'=>$vo['name']]);?>">
                                                            <i class="fa fa-angle-right"></i>
                                                            <span><?php echo ($vo['title']); ?></span>
                                                        </a>
                                                    </li><?php endif; ?>
                                            </ul>
                                        </li><?php endforeach; endif; else: echo "" ;endif; ?>
                                </ul>
                            </nav>
                            <!-- / nav -->
                        </div>
                    </section>

                    <footer class="footer lt hidden-xs b-t b-light">
                        <div id="chat" class="dropup">
                            <section class="dropdown-menu on aside-md m-l-n">
                                <section class="panel bg-white">
                                    <header class="panel-heading b-b b-light">Active chats</header>
                                    <div class="panel-body animated fadeInRight">
                                        <p class="text-sm">No active chats.</p>
                                        <p><a href="#" class="btn btn-sm btn-default">Start a chat</a></p>
                                    </div>
                                </section>
                            </section>
                        </div>
                        <div id="invite" class="dropup">
                            <section class="dropdown-menu on aside-md m-l-n">
                                <section class="panel bg-white">
                                    <header class="panel-heading b-b b-light">
                                        John <i class="fa fa-circle text-success"></i>
                                    </header>
                                    <div class="panel-body animated fadeInRight">
                                        <p class="text-sm">No contacts in your lists.</p>
                                        <p><a href="#" class="btn btn-sm btn-facebook"><i
                                                class="fa fa-fw fa-facebook"></i> Invite from Facebook</a></p>
                                    </div>
                                </section>
                            </section>
                        </div>
                        <a href="#nav" data-toggle="class:nav-xs" class="pull-right btn btn-sm btn-light btn-icon">
                            <i class="fa fa-angle-left text"></i>
                            <i class="fa fa-angle-right text-active"></i>
                        </a>
                        <div class="btn-group hidden-nav-xs">
                            <i class="fa fa-user-md"></i> 客服: <?php echo v('config.system.tel');?>
                            <!--<button type="button" title="Chats" class="btn btn-icon btn-sm btn-light" data-toggle="dropdown" data-target="#chat"><i class="fa fa-comment-o"></i></button>-->
                            <!--<button type="button" title="Contacts" class="btn btn-icon btn-sm btn-light" data-toggle="dropdown" data-target="#invite"><i class="fa fa-facebook"></i></button>-->
                        </div>
                    </footer>
                </section>
            </aside>
            <!-- /.aside -->

            <section id="content">
                <section class="vbox">
                    <section class="scrollable padder">
                        
<ul class="breadcrumb no-border no-radius b-b b-light pull-in">
    <li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
    <li><a href="#">品牌管理</a></li>
    <li><a href="#">编辑品牌</a></li>
</ul>
<div class="m-b-md">
    <h3 class="m-b-none">编辑品牌</h3>
</div>
<section class="panel panel-default">
    <header class="panel-heading font-bold">编辑品牌</header>
    <div class="panel-body">
        <form class="form-horizontal" action="" method="post">
            <div class="form-group">
                <label class="col-sm-2 control-label">所属分类</label>
                <div class="col-sm-4">
                    <select name="cid" class="form-control m-b">
                        <option value="">请选择</option>
                        <?php if(is_array($cateData)): $i = 0; $__LIST__ = $cateData;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><option value="<?php echo ($v['cid']); ?>"
                            <?php if($v['tid']==0): ?>disabled<?php endif; ?>
                            <?php if($v['cid']==$oldData['cid']): ?>selected<?php endif; ?>
                            tid="<?php echo ($v['tid']); ?>"><?php echo ($v['_cname']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                    <input type="hidden" name="tid" value="<?php echo ($oldData['tid']); ?>">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">所属品牌</label>
                <div class="col-sm-4">
                    <select name="bid" class="form-control m-b">
                        <option value="">请选择</option>
                        <?php if(is_array($brandData)): $i = 0; $__LIST__ = $brandData;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><option value="<?php echo ($v['bid']); ?>"
                            <?php if($v['bid']==$oldData['bid']): ?>selected<?php endif; ?>
                            ><?php echo ($v['bname']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>

            <div class="form-group">
                <label class="col-sm-2 control-label">商品名称（详细名称）</label>
                <div class="col-sm-4">
                    <input type="text" name="gname" value="<?php echo ($oldData['gname']); ?>" class="form-control rounded">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商品简名</label>
                <div class="col-sm-4">
                    <input type="text" name="sname" value="<?php echo ($oldData['sname']); ?>" class="form-control rounded">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商品货号</label>
                <div class="col-sm-4">
                    <input type="text" name="gnumber" value="<?php echo ($oldData['gnumber']); ?>" class="form-control">
                    <span class="help-block m-b-none">请输入商品货号。。。</span>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label" for="input-id-1">单位</label>
                <div class="col-sm-4">
                    <input type="text" name="unit" value="<?php echo ($oldData['unit']); ?>" class="form-control" id="input-id-1" value="件">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">市场价</label>
                <div class="col-sm-4">
                    <input type="text" name="marketprice" value="<?php echo ($oldData['marketprice']); ?>" class="form-control">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商城价</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control" value="<?php echo ($oldData['shopprice']); ?>" name="shopprice" placeholder="">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">点击次数</label>
                <div class="col-sm-4">
                    <input type="number" class="form-control"  value="<?php echo ($oldData['click']); ?>" name="click" placeholder="">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">库存</label>
                <div class="col-sm-4">
                    <input type="number" class="form-control" value="<?php echo ($oldData['total']); ?>" name="total" placeholder="">
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商品属性</label>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <tbody id="attr">
                            <?php if(is_array($attrData)): $i = 0; $__LIST__ = $attrData;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                    <td><?php echo ($v['taname']); ?></td>
                                    <td>
                                        <select name=attr[<?php echo ($v['taid']); ?>] id="" class="form-control m-b">
                                            <option value="">请选择</option>
                                            <?php if(is_array($v['tavalue'])): $i = 0; $__LIST__ = $v['tavalue'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vv): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vv); ?>" <?php if(in_array($vv,$hasAttr)): ?>selected<?php endif; ?>><?php echo ($vv); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                        </select>
                                    </td>
                                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group goods-spec">
                <label class="col-sm-2 control-label">商品规格</label>
                <div class="col-sm-8">
                    <table class="table table-hover">
                        <tbody id="spec">
                        <script src="/c73/php_beijing/mall/node_modules/hdjs/js/jquery.min.js"></script>
                        <?php if(is_array($specData)): $i = 0; $__LIST__ = $specData;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                <td><?php echo ($v['taname']); ?></td>
                                <td>
                                    <select name="spec[<?php echo ($v['taid']); ?>][specAttr][]" class="form-control m-b">
                                        <option value="">请选择</option>
                                        <?php if(is_array($v['tavalue'])): $i = 0; $__LIST__ = $v['tavalue'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vv): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vv); ?>" <?php if($vv==$v['gavalue']): ?>selected<?php endif; ?>><?php echo ($vv); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>
                                </td>
                                <td>附加价格</td>
                                <td>
                                    <input type="text" name="spec[<?php echo ($v['taid']); ?>][addValue][]" value="<?php echo ($v['addva']); ?>" class="form-control">
                                </td>
                                <td>
                                    <button type="button" class="del-spec btn  btn btn-block btn-danger m-b-sm">删除</button>
                                </td>
                            </tr>
                            <script>
                                $(function(){
                                    $(".goods-spec").find("tr:contains(<?php echo ($v['taname']); ?>)").eq(0).find("td:last").html('<button type="button" class="add-spec btn  btn-facebook btn-block m-b-sm">添加</button>')
                                })
                            </script><?php endforeach; endif; else: echo "" ;endif; ?>

                        </tbody>
                    </table>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>

            <!--引入uploadify相关js和css-->
            <script src="/c73/php_beijing/mall/Public/uploadify/jquery.uploadify.js"></script>
            <link rel="stylesheet" href="/c73/php_beijing/mall/Public/uploadify/uploadify.css">
            <div class="form-group">
                <label class="col-sm-2 control-label">列表图</label>
                <div class="col-sm-10">
                    <div class="col-sm-4">
                        <input type="file" name="file_upload" id="list_pic"/>
                        <input type="hidden" name="pic" value="<?php echo ($oldData['pic']); ?>">
                    </div>
                    <div class="col-sm-8" id="upload_pic_list">
                        <li path="<?php echo ($oldData['pic']); ?>">
                            <img width="80px"  src="/c73/php_beijing/mall/<?php echo ($oldData['pic']); ?>"/>
                            <a href="javascript:;"class="del_pic">X</a>
                        </li>
                    </div>
                    <style>
                        #upload_pic_list li {
                            list-style: none;
                            float: left;
                            position: relative;
                            border: 1px solid #000;
                            margin-right: 18px;
                        }

                        .del_pic {
                            position: absolute;
                            top: -3px;
                            right: -12px;
                            color: red;
                        }
                    </style>
                    <script>
                        $(function () {
                            $("#list_pic").uploadify({
                                'successTimeout': 15,
                                'swf': '/c73/php_beijing/mall/Public/uploadify/uploadify.swf',
                                'uploader': "<?php echo u('admin/goods/ajaxUploadListPic');?>",
                                'buttonText': "请上传图片",
                                'width': 120,
                                'fileSizeLimit': '2000KB',
                                'uploadLimit': 1,
                                'removeTimeout': 0.4,
                                'fileTypeExts': '*.gif; *.jpg; *.png',
                                'onUploadSuccess': function (file, data, response) {
                                    var li = '<li path="' + data + '"><img width="80px"  src="/c73/php_beijing/mall/' + data + '"/><a href="javascript:;"class="del_pic">X</a></li>';
                                    $('#upload_pic_list').append(li);
                                    $('input[name=pic]').val(data);
                                }
                            });
                        });
                    </script>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商品图册</label>
                <div class="col-sm-10">
                    <div class="col-sm-4">
                        <input type="file" name="file_upload" id="detail_pic"/>
                    </div>
                    <div class="col-sm-8" id="upload_pic_detail">
                        <?php if(is_array($oldData['big_pic'])): $i = 0; $__LIST__ = $oldData['big_pic'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><li path="<?php echo ($v); ?>"><img width="80px" src="/c73/php_beijing/mall/<?php echo ($v); ?>"/><a href="javascript:;"class="del_pic">X</a><input type="hidden" name="goodsDetailPics[]" value="<?php echo ($v); ?>"></li><?php endforeach; endif; else: echo "" ;endif; ?>
                    </div>
                    <style>
                        #upload_pic_detail li {
                            list-style: none;
                            float: left;
                            position: relative;
                            border: 1px solid #000;
                            margin-right: 18px;
                        }
                    </style>

                    <script>
                        $(function () {
                            $("#detail_pic").uploadify({
                                'successTimeout': 15,
                                'swf': '/c73/php_beijing/mall/Public/uploadify/uploadify.swf',
                                'uploader': "<?php echo u('admin/goods/ajaxUploadDetailPic');?>",
                                'buttonText': "请上传图片",
                                'width': 120,
                                'fileSizeLimit': '2000KB',
                                'uploadLimit': 10,
                                'removeTimeout': 0.4,
                                'fileTypeExts': '*.gif; *.jpg; *.png',
                                'onUploadSuccess': function (file, data, response) {
                                    var li = '<li path="' + data + '"><img width="80px" src="/c73/php_beijing/mall/' + data + '"/><a href="javascript:;"class="del_pic">X</a>';
                                    li+= '<input type="hidden" name="goodsDetailPics[]" value="'+data+'"></li>';
                                    $('#upload_pic_detail').append(li);
                                }
                            });
                        });
                    </script>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">商品详情</label>
                <div class="col-sm-10">
                    <!-- 配置文件 -->
                    <script type="text/javascript" src="/c73/php_beijing/mall/Public/uEditor/ueditor.config.js"></script>
                    <!-- 编辑器源码文件 -->
                    <script type="text/javascript" src="/c73/php_beijing/mall/Public/uEditor/ueditor.all.js"></script>
                    <!-- 实例化编辑器 -->
                    <textarea name="intro" id="intro" style="width:800px"><?php echo ($oldData['intro']); ?></textarea>
                    <script type="text/javascript">
                        var ue = UE.getEditor('intro');
                    </script>
                </div>
            </div>
            <div class="line line-dashed line-lg pull-in"></div>
            <div class="form-group">
                <label class="col-sm-2 control-label">售后服务</label>
                <div class="col-sm-10">
                    <textarea name="service" id="service" style="width:800px"><?php echo ($oldData['service']); ?></textarea>
                    <script type="text/javascript">
                        var ue = UE.getEditor('service');
                    </script>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-4 col-sm-offset-4">
                    <button class="btn btn-twitter btn-block">提交</button>
                </div>
            </div>
        </form>
    </div>
</section>
<script>
    function controller($scope, $, _) {
        $(function () {
            $('select[name=cid]').change(function () {
                var tid = $(':selected', this).attr('tid');
                $('input[name=tid]').val(tid);
                $.post("<?php echo u('admin/goods/ajaxGetAttrList');?>", {'tid': tid}, function (data) {
                    if (data != 0) {
                        var attr, spec, tmp;
                        for (var i in data) {
                            tmp = '';
                            if (data[i].tatype == 0) {
                                tmp += '<tr>';
                                tmp += '<td>' + data[i].taname + '</td>';
                                tmp += '<td>';
                                tmp += '<select name="attr['+data[i].taid+']" class="form-control m-b">';
                                var opt = data[i].tavalue.split('|');
                                var len = opt.length;
                                for (var j = 0; j < len; ++j) {
                                    tmp += '<option value="' + opt[j] + '">' + opt[j] + '</option>';
                                }
                                tmp += '</select>';
                                tmp += '</td>';
                                tmp += '</tr>';
                            } else {
                                tmp += '<tr>';
                                tmp += '<td>' + data[i].taname + '</td>';
                                tmp += '<td>';
                                tmp += '<select name="spec['+data[i].taid+'][specAttr][]" class="form-control m-b">';
                                var opt = data[i].tavalue.split('|');
                                var len = opt.length;
                                for (var j = 0; j < len; ++j) {
                                    tmp += '<option value="' + opt[j] + '">' + opt[j] + '</option>';
                                }
                                tmp += '</select>';
                                tmp += '</td>';
                                tmp += '<td>附加价格</td>';
                                tmp += '<td>';
                                tmp += '<input type="text" name="spec['+data[i].taid+'][addValue][]" class="form-control">';
                                tmp += '</td>';
                                tmp += '<td>';
                                tmp += '<button type="button" class="add-spec btn  btn-facebook btn-block m-b-sm">添加</button>';
                                tmp += '</td>';
                                tmp += '</tr>';
                            }
                            if (data[i].tatype == 0) {
                                attr += tmp;
                            } else {
                                spec += tmp;
                            }
                        }
                        $('#attr').empty().append(attr);
                        $('#spec').empty().append(spec);

                    }
                    else {
                        $('#attr').empty();
                        $('#spec').empty();
                    }
                }, 'json');
            });

            //添加一个规格
            $(document).on('click', '.add-spec', function () {
                var tr = $(this).parents('tr');
                var obj = tr.clone();
                var del = '<button type="button" class="del-spec btn  btn-block btn-danger m-b-sm">删除</button>';
                obj.find('td').eq(4).find('.add-spec').remove();
                obj.find('td').eq(4).append(del);
                tr.after(obj);
            });
            //删除一个规格
            $(document).on('click', '.del-spec', function () {
                $(this).parents('tr').remove();
            });
            //点击删除上传图片
            $(document).on('click', '.del_pic', function () {
                var path = $(this).parent().attr('path');
                var _this = $(this);
                $.post('<?php echo U("admin/goods/ajaxDelPic");?>', {path: path}, function (data) {
                    _this.parent().remove();
                });

            })

        })

    }
</script>


                    </section>
                </section>
                <a href="#" class="hide nav-off-screen-block" data-toggle="class:nav-off-screen, open"
                   data-target="#nav,html"></a>
            </section>
        </section>
    </section>
</section>
<script>
    require(['util', 'underscore'], function ($, _) {
        require(['/c73/php_beijing/mall/Public/js/app.js', 'css!/c73/php_beijing/mall/Public/css/app.css']);

        require(['angular', 'jquery'], function (angular, $) {
            angular.module('app', []).controller('ctrl', ['$scope', function ($scope) {
                if (angular.isFunction(controller)) {
                    controller($scope, $, _);
                }
            }]);
            angular.bootstrap(document.getElementsByTagName('body'), ['app']);
        });
    });
</script>
<!--<script src="/c73/php_beijing/mall/Public/js/bootstrap.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/app.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/slimscroll/jquery.slimscroll.min.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/easypiechart/jquery.easy-pie-chart.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/sparkline/jquery.sparkline.min.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/flot/jquery.flot.min.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/flot/jquery.flot.tooltip.min.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/flot/jquery.flot.resize.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/flot/jquery.flot.grow.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/charts/flot/demo.js"></script>-->

<!--<script src="/c73/php_beijing/mall/Public/js/calendar/bootstrap_calendar.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/calendar/demo.js"></script>-->

<!--<script src="/c73/php_beijing/mall/Public/js/sortable/jquery.sortable.js"></script>-->

<!--<script src="/c73/php_beijing/mall/Public/js/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/jvectormap/jquery-jvectormap-world-mill-en.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/jvectormap/demo.js"></script>-->
<!--<script src="/c73/php_beijing/mall/Public/js/app.plugin.js"></script>-->
</body>
</html>